package com.example.sys.controller;

import com.example.base.dto.R;
import com.example.sys.dto.SystemUserDTO;
import com.example.sys.service.ISystemUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.constraints.NotNull;

/**
 * <p>
 * 系统用户信息表 前端控制器
 * </p>
 *
 * @author ywh
 * @since 2024-08-13
 */
@Api(tags = "用户管理接口")
@RestController
@RequestMapping(value = "/systemUser")
public class SystemUserController {

    private ISystemUserService userService;

    @Autowired
    public SystemUserController(ISystemUserService userService){
        this.userService = userService;
    }

    @ApiOperation("用户保存")
    @RequestMapping(value = "/save", method = RequestMethod.POST)
    public R<Boolean> save(@RequestBody @Validated @NotNull(message = "请求对象为空") SystemUserDTO systemUser){
        return R.success(userService.saveUserDTO(systemUser));
    }
}
